<template>
    <div>
        <el-table
                :data="tableData"
                :height="200"
                stripe
                style="width: 100%">
            <el-table-column
                    prop="name"
                    label="测点"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="creatTime"
                    label="时间"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="value"
                    label="监测值">
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name: "dataTable",
        props: ["monitorPointId"],
        data() {
            return {
                tableData:[{"id":381,"name":"bt1","creatTime":"2017-12-30","value":196.456,"date":1514563200000},{"id":381,"name":"bt2","creatTime":"2017-12-30","value":194.678,"date":1514563200000},{"id":381,"name":"bt3","creatTime":"2017-12-30","value":194.678,"date":1514563200000}]
            }
        },
        watch: {
            monitorPointId: {
                handler(newdata, olddata) {
                    this.profileModel.profilePointCurrentList(newdata).then(res =>{
                        this.tableData = res.data;
                        //console.log(res.data);
                    }).catch(err => {
                        console.log(err.message)
                    });
                },
            }
        },
        mounted(){
            this.profileModel.profilePointCurrentList(this.monitorPointId).then(res =>{
                this.tableData = res.data;
                //console.log(res.data);
            }).catch(err => {
                console.log(err.message)
            });
        },
        methods(){

        }
    }
</script>
